import VueRouter from 'vue-router'
import Vue from 'vue'

import Home from '../components/Home/Home.vue'
import Mac from '../components/Mac/Mac'



Vue.use(VueRouter)

var router = new VueRouter({
    routes: [
        {
            path: '/',
            redirect: '/home'
        },
        {
            path: '/home',
            component: Home,
        },
        {
            path: '/member',
            component: Mac,
        },
        {
            path: '/ranking',
            component: () => import('@/views/Ranking'),
        },

        {
            path: '/sightbead',
            component: () => import('@/views/Sightbead'),

        },
        {
            path: '/BrilliantMoment',
            component: () => import('@/views/BrilliantMoment'),
        },
        {
            path: '/support',
            component: () => import('@/views/Support'),
        },
        {
            path: '/wechat',
            component: () => import('@/views/WechatList'),
        }

    ],
    mode: 'history'

})

// 经验证，这个路由守卫没什么用，因为vue-router在跳转的路径相同的时候，在执行这个路由守卫之前就拦截了
router.beforeEach((to, from, next) => {
    // console.log(to.path===from.path)
    if (to.path === from.path) {
        console.log('路由相等啦')
        return

    }
    next()
    // if (to.path == '/home' || to.path == '/member' || to.path == '/sightbead' || to.path == '/ranking' || to.path == '/wechat') {
    //     next()
    // } else {
    //     return
    // }
})


export default router

